﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using shop;


namespace comix
{
    public partial class register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LinkButton1_Command(object sender, CommandEventArgs e)
        {
            LCustomer c = (LCustomer)Session["customer"];
             if (c.Register(tb_mail.Text, tb_password.Text, "", tb_firstname.Text, tb_lastname.Text, false, chb_news.Checked, tb_address.Text, tb_city.Text, tb_tk.Text, tb_phone.Text, Convert.ToInt32(DropDownList1.SelectedValue)))
            {
                FormsAuthentication.SetAuthCookie("C" + c.Id.ToString(), false);
                Response.Redirect("result.aspx?type=register&value=ok");
            }
            else
            {
                
                Response.Redirect("result.aspx?type=register&value=nok");
            }
        }
    }
}
